/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mldn.demo;

/**
 *
 * @author Administrator
 */
public class ProxyDemo {
    public static void main(String[] args) {
        Network net = null;
        net = new Proxy(new Real());
        net.browse();
    }
}

interface Network{
    public void browse();
}

class Real implements Network{

    public void browse() {
        System.out.println("go to browse()");
    }
    
}

class Proxy implements Network{
    private Network network;

    public Proxy(Network network) {
        this.network = network;
    }
    
    public void check(){
        System.out.println("user is valid!");
    }

    public void browse() {
        this.check();
        this.network.browse();
    }
    
    
}